define([
  'jquery',
  'views/List',
  'views/subscribers/SubscriberItem',
  'views/subscribers/SubscriberModal',
  'hbs!template/subscribers/subscribers-list'
], function($, ListView, SubscriberItem, SubscriberModal, template){
  var SubscribersList = ListView.extend({
    itemView: SubscriberItem,
    listEvents: {
      "click button[name=add]":		"add",
      "click button[name=back]":        "back"
    },
    
    initList: function(options) {
      this.template = template;
      this.collection.bind("loading", this.showLoading, this);
    },
    
    add: function() {
      var modal = new SubscriberModal({
        model: new this.collection.model(),
        collection: this.collection
      });
      modal.render();
    }
  });

  return SubscribersList;
});